/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.etecmatao.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "download")
@NamedQueries({
    @NamedQuery(name = "Download.findAll", query = "SELECT d FROM Download d"),
    @NamedQuery(name = "Download.findByIdDownload", query = "SELECT d FROM Download d WHERE d.idDownload = :idDownload"),
    @NamedQuery(name = "Download.findByDescricao", query = "SELECT d FROM Download d WHERE d.descricao = :descricao"),
    @NamedQuery(name = "Download.findByStatus", query = "SELECT d FROM Download d WHERE d.status = :status")})
public class Download implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_Download")
    private Integer idDownload;
    @Basic(optional = false)
    @Column(name = "descricao")
    private String descricao;
    @Basic(optional = false)
    @Lob
    @Column(name = "arquivos")
    private byte[] arquivos;
    @Basic(optional = false)
    @Column(name = "status")
    private String status;
    @JoinColumn(name = "idCategoria_Download", referencedColumnName = "idCategoria_Download")
    @ManyToOne(optional = false)
    private CategoriaDownload categoriaDownload;

    public Download() {
    }

    public Download(Integer idDownload) {
        this.idDownload = idDownload;
    }

    public Download(Integer idDownload, String descricao, byte[] arquivos, String status) {
        this.idDownload = idDownload;
        this.descricao = descricao;
        this.arquivos = arquivos;
        this.status = status;
    }

    public Integer getIdDownload() {
        return idDownload;
    }

    public void setIdDownload(Integer idDownload) {
        this.idDownload = idDownload;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public byte[] getArquivos() {
        return arquivos;
    }

    public void setArquivos(byte[] arquivos) {
        this.arquivos = arquivos;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public CategoriaDownload getCategoriaDownload() {
        return categoriaDownload;
    }

    public void setCategoriaDownload(CategoriaDownload categoriaDownload) {
        this.categoriaDownload = categoriaDownload;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDownload != null ? idDownload.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Download)) {
            return false;
        }
        Download other = (Download) object;
        if ((this.idDownload == null && other.idDownload != null) || (this.idDownload != null && !this.idDownload.equals(other.idDownload))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "admin.model.Download[idDownload=" + idDownload + "]";
    }

}
